<template>
  <div class="box">
    <div class="top">
      <p class="title">实时游客统计</p>
      <p class="bg"></p>
      <p class="people">
        可预约总量
        <span style="color: orange">99999</span>
        人
      </p>
      <div class="number">
        <span v-for="(item, index) in person" :key="index">{{ item }}</span>
      </div>
    </div>
    <!-- echarts展示图标的盒子 -->
    <div class="charts" ref="charts">12345678</div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
let person = ref('215908人')
//引入echarts
//@ts-ignore
import * as echarts from 'echarts'
//@ts-ignore
import 'echarts-liquidfill'
//echarts图标的DOM实例
let charts = ref<any>()

onMounted(() => {
  let mycharts = echarts.init(charts.value)
  mycharts.setOption({
    series: {
      type: 'liquidFill', //系列
      data: [0.6, 0.4, 0.2], //展示的数据
      waveAnimation: true, //动画
      animationDuration: 3,
      animationDurationUpdate: 0,
      radius: '90%', //半径
      outline: {
        //外层边框颜色设置
        show: true,
        borderDistance: 8,
        itemStyle: {
          color: 'skyblue',
          borderColor: '#294D99',
          borderWidth: 8,
          shadowBlur: 20,
          shadowColor: 'rgba(0, 0, 0, 0.25)',
        },
      },
    },
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
    },
  })
})
</script>

<style scoped lang="scss">
.box {
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  margin: 5px 0px;
  .top {
    .title {
      color: white;
      font-size: 25px;
      margin-top: 10px;
      margin-left: 20px;
    }
    .bg {
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
      margin-top: 15px;
      margin-left: 20px;
    }
    .people {
      color: white;
      margin-top: 15px;
      font-size: 18px;
      margin-left: 300px;
    }
    .number {
      display: flex;
      margin-top: 5px;
      span {
        background: url('../../images/total.png') no-repeat;
        background-size: 100% 100%;
        flex: 1;
        height: 67px;
        text-align: center;
        line-height: 67px;
        font-size: 40px;
        color: #29fcff;
      }
    }
  }
  .charts {
    width: 100%;
    height: 270px;
  }
}
</style>
